home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13378 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: news.interport.net!usenet
  2. From: yaron@interport.net (Adi)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Default Class Initialisation Question...
  5. Date: Mon, 25 Mar 1996 07:29:59 GMT
  6. Organization: Interport Communications Corp.
  7. Message-ID: <4j57mv$6ps@park.interport.net>
  8. References: <00001a81+0000af6f@msn.com>
  9. NNTP-Posting-Host: yaron.port.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Tony_Bateman@msn.com (Tony Bateman) wrote:
  13.  
  14. >I have a problem concerning default initialisation of classes.
  15.  
  16. >If I define a class Rectangle, and have default initialisation values 
  17. >in the constructor defined thus:
  18.  
  19. >Rectangle::Rectangle(USHORT width=0, USHORT height=0):
  20. >itsWidth(width),       
  21. >itsHeight(height)
  22. >{}
  23.  
  24. >then I can define a rectangle to have a width = 30 and height = 0 by 
  25. >omitting one of the variables in the initialisation:
  26.  
  27. >Rectangle myRectangle(30);
  28.  
  29. >Fine. But what if I want to leave the width a default value of 0 and 
  30. >set the height to 30. How could I do it? Can it be done in C++ in a 
  31. >straightforward manner? Is there anything like a default placeholder 
  32. >that can be used?
  33.  
  34. >        Regards,
  35. >            Tony Bateman.
  36.  
  37. >-----------------------------------------------------------------------------
  38. >I live in Finland - second highest suicide rate per head of 
  39. >population in the world.
  40. >It's the beginning of spring - most common time for suicides.
  41. >Computer programmering is a recognised high risk suicide profession.
  42. >Do NOT spill my pint.....
  43. >----------------------------------------------------------------------------- 
  44. >    
  45.  
  46. Just forget about it. There is no such thing in the C++ syntax.
  47. Annoying, ahha...
  48.  
  49. Adi Degani
  50. New-York, NY
  51.  
  52.  
  53.